package com.sansui.FilterChiam;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import com.sansui.Untls.Untls;

public class FilterContent extends FilterRegular{

	@Override
	public String filterRegular(String content) {
		BufferedReader br = new BufferedReader(new InputStreamReader(Untls.getStringInputStream(content)));
		String line = null;
		StringBuffer sb = null ;
		boolean isBegin = false ;
		try {
			while((line = br.readLine()) != null){

				if(isMatchHead(line)){
					sb = new StringBuffer();
					isBegin = true;
				} else if(isMatchEnd(line)){
					sb.append(line);
					sb.append("\r\n");
					isBegin=false;
				}
				if(isBegin){
					sb.append(line);
					sb.append("\r\n");
				}
				
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return sb.toString();
	}

}
